/**
 * 工位管理-关联员工
 */
import React, { memo, useState } from 'react';
import { withRouter } from 'umi';
import AuthComponent from '@/utils/auth/AuthComponent';
import Icon from '../Icon';
import RelativeEmployeeModal from './RelativeEmployeeModal';

function Index({ onRefresh, ...rest }) {
    const [modalVisible, setModalVisible] = useState(false);
    return (
        <AuthComponent code="office:administration:adminManage:station:link">
            <Icon
                type="addnew_icon_default"
                title="关联员工"
                onClick={() => {
                    setModalVisible(true);
                }} />
            <RelativeEmployeeModal
                title="关联员工"
                visible={modalVisible}
                onCancel={() => { setModalVisible(false) }}
                onOk={() => {
                    setModalVisible(false);
                    onRefresh();
                }}
                {...rest}
            />
        </AuthComponent>
    );
}
export default withRouter(memo(Index));
